package com.spring5.webflux.reactor8;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/************************************************************************
 *
 *    Copyright  Copyright 2021 Google Inc.
 *    File Name: TestReactor
 *    Description: 描述
 *
 *    Version: V1.0
 *    Author: Fuc
 *    Create Time: 2021-01-21
 *
 *************************************************************************/

public class TestReactor {

  public static void main(String[] args) {
    // just方法直接声明元素
    Flux.just(1, 2, 3, 4).subscribe(System.out::println);
    Mono.just(1).subscribe(System.out::println);

    // 其他的方法

    Integer[] array = {1, 2, 3, 4};
    Flux.fromArray(array);

    List<Integer> list = Arrays.asList(array);
    Flux<Integer> flux = Flux.fromIterable(list);

    Stream stream = list.stream();
    Flux.fromStream(stream);
  }

}
